/**
 * @program: LeetCode
 * @description: LeetCode : 242. 有效的字母异位词
 * @author: WXY
 * @create: 2023-01-14 21:04
 * @Version 1.0
 **/
public class Num242_isAnagram {
    public static boolean isAnagram(String s, String t) {
        int count = 0;
        int[] arr = new int[26];
        for (int i = 0; i < s.length(); i++) {
            arr[s.charAt(i) - 'a']++;
        }
        for (int i = 0; i < t.length(); i++) {
            arr[t.charAt(i) - 'a']--;
        }
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] != 0) return false;
        }
        return true;
    }
}
